package cn.yo2.irain.log4money.app.accountbooks;

import java.util.List;

import org.dozer.Mapper;
import cn.yo2.irain.common.util.SpringContextUtil;

public class AccountServicesImpl implements IAccountServices {

    private IAccountDAO accountDAO;
    private Mapper mapper;
    
    public AccountVO findById(String id) {
        AccountVO vo = new AccountVO();
        Account account = accountDAO.findById(id);
        mapper.map(account, vo);
        return vo;  
    }

    public void saveAccount(AccountVO vo) throws RuntimeException {
        Account account = new Account();
        mapper.map(vo, account);
        accountDAO.saveAccount(account);
    }

    public void updateAccount(AccountVO vo) throws RuntimeException {
        Account account = new Account();
        mapper.map(vo, account);
        accountDAO.updateAccount(account);
    }

    public void deleteAccount(AccountVO vo) throws RuntimeException {
        Account account = new Account();
        mapper.map(vo, account);
        accountDAO.deleteAccount(account);
    }

    public List findAll(String userid) throws RuntimeException {
        return accountDAO.findAll(userid);
    }

    public List findInAccount() {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }

    public List findOutAccount() {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }

    public IAccountDAO getAccountDAO() {
        return accountDAO;
    }

    public void setAccountDAO(IAccountDAO accountDAO) {
        this.accountDAO = accountDAO;
    }

    public Mapper getMapper() {
        return mapper;
    }

    public void setMapper(Mapper mapper) {
        this.mapper = mapper;
    }
}
